﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using YXQ.Common.Helper;
using YXQ.Service;

namespace YXQ.Manager.Manager
{
    public partial class ModifyPassWord : BaseAdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(pwd.Value)) {
                if (AdminUser.Pwd != StringUtils.EncryptPassWord(pwd.Value,StringUtils.PassFormat.MD5).ToLower()) {
                    JsHelper.Alert(this,"对不起你输入的原始密码错误！");
                    return;
                }
            }

            if (AdminUser != null) {
                AdminUser.Pwd = StringUtils.EncryptPassWord(nepwd.Value, StringUtils.PassFormat.MD5);
                CenterService.userService.Save(AdminUser);
                JsHelper.Alert(this,"恭喜你修改成功！");
            }
        }
    }
}